package com.sn.pw.controller;

import com.sn.pw.result.Result;
import com.sn.pw.service.LogisticsInfoService;
import com.sn.pw.vo.req.ShippingOrderNumberReq;
import com.sn.pw.vo.resp.LogisticsInfoResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/logisticsInfo")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@Api(value = "物流信息相关-Api",tags = "物流信息相关-Api")
public class LogisticsInfoController {

    private final LogisticsInfoService service;

    @PostMapping("getLogisticsInfoByShippingOrderNumber")
    @ApiOperation(value = "根据出单号查询物流信息")
    public Result<LogisticsInfoResp> getLogisticsInfoByShippingOrderNumber(@Valid @RequestBody ShippingOrderNumberReq shippingOrderNumber) {
        return Result.success(service.getLogisticsInfoByShippingOrderNumber(shippingOrderNumber.getShippingOrderNumber()));
    }
}
